<template>
	<view class="lists">
		<view class="listBox">
			<view :class="['listItem']" :style="{'background-color':act == index ? actv:'#b4b4b4'}" @click="select(item)" v-for="(item,index) in list" :key="index">{{item}}</view>
		</view>
		<view class="addOther" @click="show" v-if="isAdd" >添加其他</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		props:{
			isAdd:{
				type:Boolean,
				default:true
			},
			list:{
				type:Array,
				default:()=>{
					return []
				}
			},
			name:{
				type:String,
				default:''
			},
			act:{
				type:Number,
				default:0
			},
			actv:{
				type:String,
				default:'#ffb526'
			}
		},
		components:{
	
		},
		methods: {
			/**
			 * 选项列表某一项
			 * @param {Object} o 内容
			 */
			select(o){
				this.$emit('select',{content:o,name:this.name});
			},
			show(){
				this.$emit('addData',this.name)
			}
		}
	}
	
</script>

<style lang="scss" scoped>
	.lists{
		width: 100%;
		height: auto;
		padding: 16rpx 0;
		background-color: #fff;
		border-radius: 16rpx;
		.listBox{
			
			.listItem{
				display: inline-block;
				padding: 10rpx 12rpx;
				margin: 10rpx 10rpx 0;
				border-radius: 10rpx;
				font-size: 32rpx;
				color: #fff;
				background-color: #b4b4b4;
			}
		}
		.actv{
			background-color: #ffb526 !important;
		}
		.addOther{
			display: inline-block;
			padding: 6rpx 12rpx;
			float: right;
			background-color: #ffb526;
			color: #fff;
			font-size: 32rpx;
			border-radius: 10rpx;
			margin-right: 20rpx;
			margin-top: 40rpx;
		}
		&:after{
			clear: both;
			content: "";
			display: block;
		}
	}
</style>
